home *** CD-ROM | disk | FTP | other *** search
- From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
- Message-ID: <4g11oe$b2d@mulga.cs.mu.OZ.AU>
- X-Original-Date: 16 Feb 1996 04:38:38 GMT
- Path: in2.uu.net!bounce-back
- Date: 16 Feb 96 04:39:50 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: Legal C++ code?
- Organization: Comp Sci, University of Melbourne
- References: <4fvtk3$16j@cnn.Princeton.EDU>
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMSQKpOEDnX0m9pzZAQEjjgF/XRhQ70WrurXQyPGZuuAL5FHUVWy2lnUl
- hNy+CemtNXGLe1hytek0SOAVyD1pklJw
- =v+fV
-
- tim@franck.Princeton.EDU (Tim Hollebeek) writes:
-
- >Is the following legal C++ code? g++ compiles it, but it doesn't link
- >(undefined function Foo::foo()).
-
- No, the following code is not legal, because you don't have a definition
- for the pure virtual function Foo::foo(). But if you add one, e.g.
-
- int Foo::foo() { return 42; }
-
- then the code is quite legal.
-
- >I'm suprised it compiles at all:
-
- It has always been legal in C++ to provide a definition for pure
- virtual functions, although the only way to invoke such a function is
- by using an explicit qualification.
-
- Yes, this suprised me too ;-) I think it would have been simpler to
- disallow definitions of pure virtual functions.
-
- --
- Fergus Henderson WWW: http://www.cs.mu.oz.au/~fjh
- fjh@cs.mu.oz.au PGP: finger fjh@128.250.37.3
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. Moderation policy:
- http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
-